#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int brokenCalc(int startValue, int target) {
        int ret = 0;
        while (startValue < target)
        {
            ret++;
            if (target % 2) target++;
            else target /= 2;
        }
        return ret + startValue - target;
    }
};